//
//  MZY_designerPic.m
//  FullHouse
//
//  Created by dllo on 16/1/26.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_designerPic.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
#define HORIZONTAL [UIScreen mainScreen].bounds.size.width / 414
#define VERTICAL [UIScreen mainScreen].bounds.size.height / 736

@implementation MZY_designerPic

- (void)dealloc
{
    [self.screenView release];
    [self.picImageView release];
    [self.titleLabel release];
    [self.contentLabel release];
    [self.priceLabel release];
    [self.zanButton release];
    [self.likeCountLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.contentView.backgroundColor = [UIColor lightGrayColor];
    
    self.screenView = [[UIView alloc]init];
    self.screenView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.screenView];
    [self.screenView release];
    
    self.picImageView = [[UIImageView alloc]init];
    [self.screenView addSubview:self.picImageView];
    [self.picImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.screenView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.contentLabel = [[UILabel alloc]init];
    [self.screenView addSubview:self.contentLabel];
    [self.contentLabel release];
    
    self.priceLabel = [[UILabel alloc]init];
    self.priceLabel.backgroundColor = [UIColor orangeColor];
    [self.screenView addSubview:self.priceLabel];
    [self.priceLabel release];
    
    self.zanButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.screenView addSubview:self.zanButton];
    [self.zanButton release];
    
    self.likeCountLabel = [[UILabel alloc]init];
    [self.screenView addSubview:self.likeCountLabel];
    [self.likeCountLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.screenView.frame = CGRectMake(10, 10, WIDTH - 20, HEIGHT - 20);
    self.picImageView.frame = CGRectMake(0, 0, WIDTH - 20, HEIGHT - 90);
    self.titleLabel.frame = CGRectMake(10, HEIGHT - 80, 200, 20);
    self.contentLabel.frame = CGRectMake(10, HEIGHT - 50, 330 * HORIZONTAL, 20);
    self.priceLabel.frame = CGRectMake(WIDTH - 120, 10, 100, 30);
    self.zanButton.frame = CGRectMake(WIDTH - 50, HEIGHT - 80, 20, 20);
    self.likeCountLabel.frame = CGRectMake(WIDTH - 50, HEIGHT - 50, 30, 20);
}

@end
